import { defineStore } from 'pinia'
import { ref } from 'vue'
import { pinia } from './pinia'

export const useLangStore = defineStore(
  'Lang',
  () => {
    const lang = ref('zh')
    const changeLangFn = (langValue) => {
      lang.value = langValue
    }
    return { lang, changeLangFn }
  },
  {
    persist: true,
  }
)

export function useLangStoreHook() {
  return useLangStore(pinia)
}
